package com.ymttest.database.mapping;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import com.ymttest.database.model.YmtProductActivityStock;

public interface YmtProductActivityStockMapper {
	int updateStockByActivityIdAndProductId(Map<String, Object> record);

	List<YmtProductActivityStock> selectByProductId(String productId);

	YmtProductActivityStock selectByProductInActivityId(int productInActivityId);
	YmtProductActivityStock selectByCatalogId(String catalogId);

	Map selectBy(Map<String, Object> searchMap);
	/**
	 * @param record
	 * @return
	 */
	@Update("update Ymt_ProductActivityStock set iStockNum = 0 where sProductID =#{pid}  AND iAction > -1 AND iStockNum > 0")
	int updateStock0ByProductId(@Param("pid") String pid);
	@Update(" update Ymt_ProductActivityStock set dBeginTime =  #{dBeginTime} where iProductInActivityId = #{iProductInActivityId}")
	int updateStartTimeByiProductInActivityId(Map m);
	
	int updateiStockNumByProductActivityStockId(String productActivityStockID,int stockNum) ;
	int updateSourceIdByProductActivityStockId(String productActivityStockID,int sourceId)  ;
	int updateiActionByActivityIdAndProductId(int iAction,String sProductID,Integer iActivityID );
}
